package vn.aptech.leaveManagementSystem.business;

import java.sql.ResultSet;
import java.sql.SQLException;

import vn.aptech.leaveManagementSystem.business.dto.Employee;
import vn.aptech.leaveManagementSystem.business.dto.UserLoginDTO;
import vn.aptech.leaveManagementSystem.business.dto.UserLoginInfo;
import vn.aptech.leaveManagementSystem.business.model.MyModel;
import vn.aptech.leaveManagementSystem.business.parse.MyParse;

public class UserManager {
	
	public boolean checkLogin(UserLoginDTO user) throws SQLException
	{
		
		MyModel mymodel=new MyModel();
		ResultSet rs=mymodel.employees.CheckLogin(user);
		if (rs.next())
		{
			Employee empInfo=MyParse.toEmployee(rs);
			UserLoginInfo.setUserInfo(empInfo);
			return true;
		}
		else
		{
			UserLoginInfo.setUserInfo(null);
			return false;
		}
	}
}
